<?php
/**
 * Author: hades
 * DateTime: 2020/4/20 18:33
 */

namespace App\Controller\admin;


use App\Controller\Base;
use App\Event\AdminActionLog;
use Psr\EventDispatcher\EventDispatcherInterface;

class AdminBase extends Base {
    private function getEvent() {
        return $this->di->get(EventDispatcherInterface::class);
    }

    /**
     * 添加操作记录
     * @param string $log
     */
    protected function addAction(string $log) {
        $this->getEvent()->dispatch(new AdminActionLog(1, $log));
    }

    /**
     * 修改操作记录
     * @param string $log
     */
    protected function changeAction(string $log) {
        $this->getEvent()->dispatch(new AdminActionLog(2, $log));
    }

    /**
     * 删除操作记录
     * @param string $log
     */
    protected function deleteAction(string $log) {
        $this->getEvent()->dispatch(new AdminActionLog(3, $log));
    }
}
